package com.business.dashboard.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * 密码生成工具类
 * 
 * @author Claude
 * @since 2025-07-06
 */
public class PasswordGenerator {
    
    public static void main(String[] args) {
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        
        // 生成admin123的BCrypt密码
        String password = "admin123";
        String encodedPassword = encoder.encode(password);
        
        System.out.println("原密码: " + password);
        System.out.println("加密后: " + encodedPassword);
        
        // 验证密码
        boolean matches = encoder.matches(password, encodedPassword);
        System.out.println("密码验证: " + matches);
        
        // 验证现有的密码
        String existingPassword = "$2a$10$7JB720yubVSQLVM9VvbYNeReNdHSDBuSaJU5wCK.S.VGX9ByVR2zW";
        boolean existingMatches = encoder.matches(password, existingPassword);
        System.out.println("现有密码验证: " + existingMatches);
    }
}